<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Ann;
use app\common\model\Banner;
use app\common\model\Category;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $banner = Banner::all();
        $ann = Ann::limit(3)->where('type', '1')->where('state', '2')->select();
        $this->success('请求成功', compact('banner', 'ann'));
    }
    /**
     * @Author LK
     * @ApiTitle (轮播接口)
     * @ApiMethod (get)
     * @ApiParams (name="type", type="integer", required=true, sample="", description="firm=企业轮播；mall=商城轮播")
     * @ApiReturnParams (name="code", type="integer", required=true, description="")
     * @ApiReturn ({'code':1,'msg':'返回成功'})
     */
    public function banner()
    {
        $get = request()->get();
        extract($get);
        $lists = Category::all(['type' => $type]);
        $this->success('请求成功', $lists);
    }
}
